<?php

class Framework {

	/**
	 * 类搜索路径列表
	 * @var array
	 */
	public $includePaths = array();

	/*--------- 类文件扩展名列表 ------------*/
	//public $extensionNames = array('.class.php');
	/**
	 * 产品类型
	 * @var string
	 */
	public $proType = '';

	/**
	 * 版本号
	 * @var string
	 */
	public $version = '';

	public function __construct () {
		if (!( is_dir(SERVER_ROOT_PATH . '/lib' )||is_dir(SERVER_ROOT_PATH.'/classes')||is_dir(SERVER_ROOT_PATH.'/business'))) {
			//这错误提示需要日后修改
			echo "非法调用";
		}
		/* 默认搜索路径 */
		array_push($this->includePaths, SERVER_ROOT_PATH . '/lib', SERVER_ROOT_PATH.'/classes',SERVER_ROOT_PATH.'/business');
		/* 自动加载函数注册 */
		if (method_exists($this, '__autoload')) {
			spl_autoload_register(array($this, '__autoload'));
		}
	}

	public function __autoload ($classname) {
		foreach ($this->includePaths as $path) {
			$filename = $path . DIRECTORY_SEPARATOR . ucfirst(str_replace('_', DIRECTORY_SEPARATOR, $classname)) . '.class.php';
			if (file_exists($filename)) {
				require_once $filename;
				return true;
			}
		}
	}

}
?>